<?php

if($_POST) {
  require_once "../config.php";
  require_once "../util.php";
  connect_db();

  $sql = $_POST['sql'];
  header ('Content-type: text/html; charset=utf-8');
  //$succ = 1;
  $succ = mysql_query($sql);
  
  if (!$succ) {
    echo "fail, ($sql), 数据库失败了:" . mysql_error();
    echo sprintf("<br />%s@%s:%s", $_SESSION['dbuser'], $_SESSION['dbname'], $_SESSION['dbpwd']);
  } else {
    echo 'mysql更新成功了' . mysql_affected_rows() . '行';
  }
} else {
  echo "I'm getting a GET request, should be POST";
}
?>
